package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.KaoQinService;

import net.sf.json.JSONObject;
/**
 * 通过名字查询考勤后台
 * @author 周钟鸣
 *
 */
public class CheckNameKaoQinController extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doGet(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		resp.setCharacterEncoding("utf8");
		KaoQinService kqs=new KaoQinService();
		String wname=req.getParameter("wname");
		String page = req.getParameter("page");
		String rows = req.getParameter("rows");
		 //分页显示
		 int start = (Integer.parseInt(page)-1)*Integer.parseInt(rows);
		 JSONObject jb=kqs.findOnePersonAllKaoqin(wname,start,Integer.parseInt(rows));
		 PrintWriter  pw = resp.getWriter();
		 pw.write(jb.toString());
	}
}
